if [ ! -f /pentest/exploits/exploitdb/files.csv ] ; then
echo "Installing latest ExploitDB archive"
cd /pentest/temp && wget http://www.exploit-db.com/archive.tar.bz2
bunzip2 archive.tar.bz2 && tar xvf archive.tar
rm -rf /pentest/exploits/exploitdb && mkdir /pentest/exploits/exploitdb
mv platforms/ /pentest/exploits/exploitdb/ && mv files.csv /pentest/exploits/exploitdb/
rm -rf archive.tar && sudo chmod -R 755 /pentest/exploits/exploitdb
fi
if [ ! -d /pentest/exploits/packetstorm ] ; then 
mkdir /pentest/exploits/packetstorm
echo "Beginning Packetstorm Update"
fi
if [ ! -d /pentest/exploits/packetstorm/1999 ] ; then
echo "Retrieving exploits for 1999"
mkdir /pentest/exploits/packetstorm/1999 && cd /pentest/exploits/packetstorm/1999
wget http://dl.packetstormsecurity.net/9912-exploits/1999-exploits.tgz --proxy=off
tar zxvf 1999-exploits.tgz && rm 1999-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2000 ] ; then
echo "Retrieving exploits for 2000"
mkdir /pentest/exploits/packetstorm/2000 && cd /pentest/exploits/packetstorm/2000
wget http://dl.packetstormsecurity.net/0012-exploits/2000-exploits.tgz --proxy=off
tar zxvf 2000-exploits.tgz && rm 2000-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2001 ] ; then
echo "Retrieving exploits for 2001"
mkdir /pentest/exploits/packetstorm/2001 && cd /pentest/exploits/packetstorm/2001
wget http://dl.packetstormsecurity.net/0112-exploits/2001-exploits.tgz --proxy=off
tar zxvf 2001-exploits.tgz && rm 2001-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2002 ] ; then
echo "Retrieving exploits for 2002"
mkdir /pentest/exploits/packetstorm/2002 && cd /pentest/exploits/packetstorm/2002
wget http://dl.packetstormsecurity.net/0212-exploits/2002-exploits.tgz --proxy=off
tar zxvf 2002-exploits.tgz && rm 2002-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2003 ] ; then
echo "Retrieving exploits for 2003"
mkdir /pentest/exploits/packetstorm/2003 && cd /pentest/exploits/packetstorm/2003
wget http://dl.packetstormsecurity.net/0312-exploits/2003-exploits.tgz --proxy=off
tar zxvf 2003-exploits.tgz && rm 2003-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2004 ] ; then
echo "Retrieving exploits for 2004"
mkdir /pentest/exploits/packetstorm/2004 && cd /pentest/exploits/packetstorm/2004
wget http://dl.packetstormsecurity.net/0412-exploits/2004-exploits.tgz --proxy=off
tar zxvf 2004-exploits.tgz && rm 2004-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2005 ] ; then
echo "Retrieving exploits for 2005"
mkdir /pentest/exploits/packetstorm/2005 && cd /pentest/exploits/packetstorm/2005
wget http://dl.packetstormsecurity.net/0512-exploits/2005-exploits.tgz --proxy=off
tar zxvf 2005-exploits.tgz && rm 2005-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2006 ] ; then
echo "Retrieving exploits for 2006"
mkdir /pentest/exploits/packetstorm/2006 && cd /pentest/exploits/packetstorm/2006
wget http://dl.packetstormsecurity.net/0612-exploits/2006-exploits.tgz --proxy=off
tar zxvf 2006-exploits.tgz && rm 2006-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2007 ] ; then
echo "Retrieving exploits for 2007"
mkdir /pentest/exploits/packetstorm/2007 && cd /pentest/exploits/packetstorm/2007
wget http://dl.packetstormsecurity.net/0712-exploits/2007-exploits.tgz --proxy=off
tar zxvf 2007-exploits.tgz && rm 2007-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2008 ] ; then
echo "Retrieving exploits for 2008"
mkdir /pentest/exploits/packetstorm/2008 && cd /pentest/exploits/packetstorm/2008
wget http://dl.packetstormsecurity.net/0812-exploits/2008-exploits.tgz --proxy=off
tar zxvf 2008-exploits.tgz && rm 2008-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2009 ] ; then
echo "Retrieving exploits for 2009"
mkdir /pentest/exploits/packetstorm/2009 && cd /pentest/exploits/packetstorm/2009
wget http://dl.packetstormsecurity.net/0912-exploits/2009-exploits.tgz --proxy=off
tar zxvf 2009-exploits.tgz && rm 2009-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2010 ] ; then
echo "Retrieving exploits for 2010"
mkdir /pentest/exploits/packetstorm/2010 && cd /pentest/exploits/packetstorm/2010
wget http://dl.packetstormsecurity.net/1012-exploits/2010-exploits.tgz --proxy=off
tar zxvf 2010-exploits.tgz && rm -rf 2010-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2011 ] ; then
echo "Retrieving exploits for 2011"
mkdir /pentest/exploits/packetstorm/2011 && cd /pentest/exploits/packetstorm/2011
wget http://dl.packetstormsecurity.net/1112-exploits/2011-exploits.tgz --proxy=off
tar zxvf 2011-exploits.tgz && rm 2011-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2012 ] ; then
echo "Retrieving exploits for 2012"
mkdir /pentest/exploits/packetstorm/2012 && cd /pentest/exploits/packetstorm/2012
wget http://dl.packetstormsecurity.net/1212-exploits/2012-exploits.tgz
tar zxvf 2012-exploits.tgz && rm 2012-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2013 ] ; then
echo "Retrieving exploits for 2013"
mkdir /pentest/exploits/packetstorm/2013 && cd /pentest/exploits/packetstorm/2013
wget http://dl.packetstormsecurity.net/1312-exploits/2013-exploits.tgz
tar zxvf 2013-exploits.tgz && rm 2013-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2014 ] ; then
echo "Retrieving exploits for 2014"
mkdir /pentest/exploits/packetstorm/2014 && cd /pentest/exploits/packetstorm/2014
wget http://dl.packetstormsecurity.net/1412-exploits/2014-exploits.tgz
tar zxvf 2014-exploits.tgz && rm 2014-exploits.tgz
fi

# monthly exploit updates until the year is complete
[ ! -d /pentest/exploits/packetstorm/2015 ] && mkdir /pentest/exploits/packetstorm/2015

if [ ! -d /pentest/exploits/packetstorm/2015/1501-exploits ] ; then
echo "Retrieving exploits for Jan 2015"
cd /pentest/exploits/packetstorm/2015 && wget http://dl.packetstormsecurity.net/1501-exploits/1501-exploits.tgz
tar xvf 1501-exploits.tgz && rm -rf 1501-exploits.tgz
fi
if [ ! -d /pentest/exploits/packetstorm/2015/1502-exploits ] ; then
echo "Retrieving exploits for Feb 2015"
cd /pentest/exploits/packetstorm/2015 && wget http://dl.packetstormsecurity.net/1502-exploits/1502-exploits.tgz
tar xvf 1502-exploits.tgz && rm -rf 1502-exploits.tgz
fi
